# v447 Customer Portal Locked Test-Session Preparation Addendum

v447 adds customer portal locked test-session preparation to the subscription and entitlement architecture.

## Added architecture behavior

- Super Admin can review customer portal locked preparation from `/admin/subscriptions`.
- The new review API is `/api/admin/stripe-customer-portal/test-session-preparation`.
- The existing workspace customer portal route `/api/subscriptions/stripe-customer-portal` now exposes locked test-session preparation context.
- Workspace Admin `/billing` now includes a guarded Subscription portal card.
- The prepared portal session shape is intentionally limited to a future Stripe Billing Portal session request using the saved Stripe test customer ID and a return path back to Billing.
- v447 records review evidence through `SuperAdminAuditEvent`; it does not require schema changes.

## Required guardrails

- Customer portal session creation remains off.
- Customer portal URL return remains off.
- Payment collection remains off.
- Webhook subscription mutation remains off.
- Trial-to-paid conversion remains off.
- Hard billing gates remain off.
- Broker distribution limits, owned portal rules, and internal load-board access remain unchanged.

## Activation sequence implication

The next activation step can review controlled checkout and portal URL return, but only after confirming the v447 portal preparation evidence and export rows are clean. Live payment collection and hard gates remain later steps.

---

# v347 Platform Subscription Stripe Test Subscription Note

- Super Admin platform subscriptions now support a controlled Stripe test-mode subscription creation scaffold.
- The Stripe platform path can create a test customer first, then create a test subscription only when a `cus_` customer ID and `price_` monthly plan price ID are present.
- This remains separate from the future Workspace Admin dispatcher-service Stripe path for billing carriers.
- Carrier/company billing to brokers and shippers remains factoring or Net 30 based and does not use this platform subscription Stripe path.
- Live charging, checkout, payment method collection, and customer portal workflows remain intentionally disabled until later controlled billing tracks.

CURRENT CANONICAL BASELINE
Version: v39
Status: documentation expansion package
Next planned package: v40

# Subscriptions and Entitlements Plan

## Current phase note
- v39.1 formalizes workspace subscriptions, billing control, entitlements, seat governance, and plan-based feature access.

## Purpose
This document defines how Dispatch Spot should model subscriptions and entitlements so workspace billing, feature access, seat limits, plan upgrades, and platform overrides remain consistent and extensible.

## Core Principle
Subscriptions belong to the workspace account, not to individual users.
Users inherit entitlements through workspace membership and role policy.

## Planned Billing Objects
- billing account
- plan
- price
- subscription
- subscription item
- invoice
- payment event
- billing adjustment
- add-on
- workspace entitlement
- workspace usage counter

## Plan Types to Support
- free or internal development plan
- trial plan
- monthly plan
- annual plan
- enterprise custom plan
- add-on expansions

## Example Entitlement Dimensions
A plan may govern:
- maximum users
- maximum active drivers
- maximum active loads
- document storage limits
- CRM access
- invoicing access
- analytics access
- automation access
- API access
- SMS notification access
- support tier

## Self-Service Billing Responsibilities
Workspace Owner or Billing Admin should be able to:
- start trial
- select plan
- upgrade
- downgrade
- cancel
- resume
- update billing details
- view invoices
- view payment failures
- manage seat count
- purchase add-ons
- view current entitlements

## Super Admin Billing Responsibilities
Super Admin should additionally be able to:
- override plan
- extend trial
- grant credits
- comp a workspace
- pause billing
- force-cancel subscription
- flag delinquency
- attach support notes
- restore access after resolution

## Entitlement Engine Direction
Feature checks should resolve through a dedicated entitlement layer rather than random conditional logic in pages.

Examples:
- hasFeature(workspaceId, "crm")
- hasFeature(workspaceId, "analytics")
- hasCapacity(workspaceId, "users")
- hasCapacity(workspaceId, "drivers")

## Entitlement Sources
Workspace entitlements may derive from:
- active subscription plan
- add-ons
- support overrides
- grandfathered rights
- promotional grants
- enterprise custom contracts

## Seat Governance Direction
The platform should support:
- active licensed users
- invited but unaccepted users
- deactivated users no longer consuming seats when policy allows
- seat threshold notifications
- seat overage logic by plan

## Subscription Event Examples
- trial started
- trial ending soon
- subscription activated
- payment failed
- subscription renewed
- subscription downgraded
- add-on purchased
- seat threshold reached

## Recommended Admin and Workspace Billing Surfaces
### Workspace Billing Center
- current plan
- included features
- seat usage
- renewal date
- invoices
- payment status
- add-ons
- upgrade and downgrade actions

### Super Admin Billing Console
- workspace subscription search
- failed payment queue
- trial management
- custom pricing support
- credits and manual adjustments
- subscription override history

## Build Rule Going Forward
Plan enforcement and capacity checks must be centralized through an entitlement service so pricing and packaging can evolve without widespread code rewrites.

## v336 update — Super Admin subscription plan foundation
The subscription plan foundation has moved from planning-only documentation into the Super Admin UI.

Implemented foundation:
- `/admin/subscriptions` page.
- Staged plan list and plan editor.
- CRUD-ready browser-side controls for creating, editing, duplicating, and deleting staged plans.
- Plan limits for users, trucks, and business phone numbers.
- Add-on price preparation for extra users/seats and extra business phone numbers.
- Feature access preparation for dispatch, documents, billing, notifications, business phone, route planning, load board, reports, and CORI.

Not yet implemented:
- Database persistence for plans.
- Workspace subscription assignment.
- Stripe or billing provider integration.
- Hard enforcement against workspace usage.
- Invoice/payment lifecycle.

Next recommended subscription steps:
1. Add workspace subscription assignment to Super Admin workspace pages.
2. Add a shared entitlement checker used by Workspace Admin pages.
3. Add soft warnings when a workspace exceeds included limits.
4. Add plan upgrade/add-on prompts only where useful and not cluttering daily workflow.

## v337 Staged Workspace Assignment Visibility
The staged subscription plan foundation is now connected to Super Admin workspace review. Super Admin can inspect the staged plan for each workspace, included versus over-limit usage, and included/locked feature access before database-backed persistence is introduced.

Current staged signals:
- users/seats
- trucks
- business phone numbers
- Dispatch
- Documents
- Billing
- Notifications
- Business phone
- Route planning
- Load board
- Reports
- CORI

The next required subscription step is persistence: subscription plan tables, workspace subscription assignment, add-on records, billing status, and shared enforcement helpers for Workspace Admin pages.


## v338-v343 update — persisted subscriptions, entitlements, add-ons, and Stripe-ready billing

The subscription system has moved from staged planning into the core SaaS architecture.

Implemented through v343:
- Persisted `SubscriptionPlan` and `WorkspaceSubscription` Prisma models.
- Super Admin saved plan CRUD at `/admin/subscriptions`.
- Super Admin workspace plan assignment at `/admin/workspaces/subscriptions`.
- Shared entitlement evaluation for feature access, locked states, over-limit states, billing holds, and enforcement readiness.
- Clean Workspace Admin feature gating for selected modules without exposing Super Admin-level billing detail.
- Plan limit checks for users/seats, trucks, and business phone numbers.
- Add-on readiness review for extra users/seats, extra trucks, extra business phone numbers, and future feature add-ons.
- Stripe-ready billing provider fields on subscription plans and workspace subscriptions.

Billing architecture now separates:
- Super Admin platform subscriptions: future Stripe integration for Dispatch Spot SaaS billing.
- Workspace Admin dispatcher-service billing: a separate future Stripe path for dispatchers billing carriers for their service.
- Carrier/company billing to brokers or shippers: factoring or Net 30 flows, not Stripe.

Important current limitation:
- v343 prepares Stripe identifiers and billing mode/status fields but does not enable live Stripe charging, webhooks, checkout, customer portal, or invoice sync yet.

Next recommended subscription steps:
1. Harden editable add-on assignments inside Super Admin.
2. Add provider-sync readiness checks before real Stripe API calls.
3. Add Stripe test-mode integration for Super Admin platform subscriptions only.
4. Keep Workspace Admin clean and show only simple upgrade or plan-limit messages when needed.

## v345 update — Stripe test-mode customer/subscription scaffold

- Added a Super Admin-only `/admin/stripe-scaffold` page for safe platform billing preparation.
- The scaffold validates whether Stripe appears to be in test mode, whether the selected plan has a monthly Stripe price ID, and whether the selected workspace has a test customer ID staged.
- Super Admin can preview the future Stripe customer and subscription payload shape before any Stripe SDK/API call is enabled.
- Super Admin can manually store confirmed test-mode customer, subscription, and subscription item IDs on the workspace subscription.
- This remains a scaffold only: it does not create Stripe customers, checkout sessions, portal sessions, subscriptions, invoices, payment methods, or charges.
- Workspace Admin remains clean. No Stripe controls are exposed to normal workspace users.
- Platform subscription billing remains separate from the future Workspace Admin dispatcher-service Stripe path for billing carriers. Carrier/company billing to brokers and shippers continues to rely on factoring or Net 30 workflows.

## v346 Platform Stripe customer creation note

v346 adds controlled Stripe SDK test-mode customer creation for Super Admin platform subscriptions.

This is intentionally limited to test customer creation only. It does not create Stripe subscriptions, invoices, checkout sessions, customer portal sessions, payment methods, or charges.

The platform billing path remains separate from Workspace Admin dispatcher-service billing. Dispatcher-service Stripe billing for carrier customers will be added later as a separate billing path.


## v349 Stripe webhook test-event handling note

Dispatch Spot now has a Super Admin-only Stripe test webhook handling foundation for platform subscriptions. The webhook endpoint is `/api/subscriptions/stripe-test/webhook`. It is limited to safe test-mode provider sync updates and does not enable checkout, customer portal, live billing, add-ons, payment method collection, or charges. Workspace Admin dispatcher-service Stripe billing remains a separate future path.

## v417 plan-family visibility cleanup controls

v417 adds Super Admin plan-family visibility cleanup controls to `/admin/subscriptions` before registration/workspace-type plan-selection staging begins.

Current behavior:

- Super Admin can review plan family, plan visibility, and visible workspace type lists directly inside the saved plan manager.
- Super Admin can apply a recommended visibility/type-list helper to the selected plan draft and then save the plan.
- Visibility review counts identify plans with missing type lists, public staged visibility, and family/type-list mismatch warnings.
- Clearing a visible workspace type list is now persisted intentionally instead of leaving an older list unchanged.

Important limitation:

- These fields remain metadata only. Registration plan selection, Stripe checkout, hard billing gates, broker distribution limits, owned portal rules, and internal load-board access are still not activated.

## v418 Super Admin registration readiness checklist

v418 adds a Super Admin-only registration readiness checklist to `/admin/subscriptions` before registration/workspace-type plan-selection staging begins.

Current behavior:

- Super Admin can review whether active workspaces have stored workspace type/account class values.
- Super Admin can see whether saved plans have usable plan family, plan visibility, and visible workspace type metadata.
- Super Admin can see whether any Public or Invite only customer plans are staged as future registration choices.
- Super Admin can identify paid workspace subscription gaps, assigned plan/workspace-type mismatches, and trial records missing trial end dates.
- Super Admin can see guarded Stripe/billing and broker/marketplace policy warnings before any registration work relies on these values.

Important limitation:

- This is review-only readiness visibility. It does not activate signup plan selection, Stripe checkout, billing enforcement, broker distribution limits, owned portal rules, or internal load-board access.

## v419 registration workspace-type plan-selection staging

v419 activates the first public signup staging step for workspace type and plan selection, but keeps the workflow review-only.

Current behavior:

- `/sign-up` now asks the registrant to select a workspace type before entering company/admin details.
- The public workspace type choices are limited to paid workspace candidates: Dispatcher, Company / Fleet, Carrier / Owner-Operator, and Freight Broker.
- `/sign-up` reads `/api/auth/sign-up/options` for sanitized staged plan options.
- The signup options endpoint only returns non-retired Public or Invite only customer plans that are visible for paid workspace types.
- The endpoint does not expose Stripe product IDs, Stripe price IDs, provider sync state, internal billing notes, private plans, internal plans, driver-interface plans, platform marketplace plans, or internal operations plans.
- When a user creates a workspace, the selected workspace type is stored on `Organization.workspaceType` and the account class is stored as `PAID_WORKSPACE`.
- When a valid staged plan is selected, the new workspace trial subscription uses that plan.
- When no staged plan exists for the selected type, workspace creation falls back to the existing safe default plan so registration does not fail.

Important limitation:

- This is a review-only trial signup step. It does not collect payment, create Stripe checkout sessions, create customer portal sessions, enforce hard billing gates, activate broker distribution limits, change owned portal rules, or open internal load-board access.


## v419.1 registration workspace-type plan-selection build fix

v419.1 fixes the v419 WHM build error without changing product behavior.

Current behavior:

- Public registration still supports only paid workspace candidates: Dispatcher, Company / Fleet, Carrier / Owner-Operator, and Freight Broker.
- The allowed public registration workspace types are now stored in a typed `readonly WorkspaceType[]` constant so TypeScript can safely check the full enum value.
- Shipper/customer portals, driver-interface records, platform marketplace layers, and internal operations workspaces remain unavailable from public registration.

Important limitation:

- This is a build fix only. It does not activate Stripe checkout, payment collection, hard billing gates, broker distribution limits, owned portal rules, or internal load-board access.

## v437 subscription lifecycle and review-only billing sync

v437 adds a Super Admin-only subscription lifecycle review layer to `/admin/subscriptions`.

Current behavior:

- Super Admin can review trial, active, past-due, paused, canceled, and missing-subscription workspaces in one place.
- The review includes the saved plan, trial end date, current period end date, provider, billing mode, provider sync status, masked Stripe IDs, duplicate Stripe ID warnings, recent webhook billing-sync signals, and first-fix guidance.
- Super Admin can filter lifecycle records by readiness, lifecycle state, provider, risk type, and search text.
- Super Admin can export lifecycle review rows and review-only webhook billing-sync rows.
- Workspace Admin messaging remains soft and informational; no billing gate or provider-driven status mutation is activated.

Important limitation:

- This is review-only lifecycle visibility. It does not activate billing status mutation, payment collection, customer portal sessions, webhook subscription mutation, trial-to-paid conversion, hard billing gates, broker distribution limits, owned portal rules, or internal load-board access.

## v438 soft billing warnings and hard-gate readiness checklist

v438 adds a warning-only bridge between review-only subscription lifecycle data and any future hard billing-gate activation.

Current behavior:

- Workspace billing lifecycle problems are surfaced as soft warnings while `DISPATCH_SPOT_HARD_BILLING_GATES_ENABLED` is not true.
- Workspace Admin Billing can show a simple Subscription notice for missing subscription, trial issues, past-due status, paused/canceled status, missing plan, provider sync error, or over-limit usage.
- Super Admin can review hard-gate readiness in `/admin/subscriptions`, including subscription coverage, lifecycle warning coverage, plan-limit pressure, add-on price readiness, workspace type/account class readiness, provider sync state, and environment guardrails.
- Super Admin can export hard-gate readiness and checklist CSVs.
- The shared entitlement evaluator now treats past-due, paused, canceled, and over-limit states as review/warning states when hard gates are off.

Important limitation:

- This is not billing activation. It does not collect payment, create customer portal sessions, mutate subscription status from webhooks, convert trials to paid subscriptions, enforce hard billing gates, change broker distribution limits, change owned portal rules, or open internal load-board access.

## v439 lifecycle sync audit notes and warning acknowledgement history

v439 adds review evidence around the soft billing warning and lifecycle review layer introduced in v437 and v438.

Current behavior:

- Super Admin can add review-only lifecycle audit notes from the Subscription lifecycle panel.
- Lifecycle review now identifies risky rows that still have no audit note.
- Lifecycle audit notes are stored as `SuperAdminAuditEvent` records with action `SUBSCRIPTION_LIFECYCLE_SYNC_AUDIT_NOTE_ADDED`.
- Workspace Admins can acknowledge a visible soft Subscription notice from `/billing`.
- Warning acknowledgements are stored as `SuperAdminAuditEvent` records with action `WORKSPACE_BILLING_WARNING_ACKNOWLEDGED`.
- The soft-warning API now returns the current warning fingerprint, acknowledgement state, acknowledgement count, and recent acknowledgement history.
- Super Admin can see warning acknowledgement history alongside lifecycle review status.

Important limitation:

- This is still not billing activation. Audit notes and warning acknowledgements do not collect payment, create customer portal sessions, mutate subscription status, convert trials to paid subscriptions, enforce hard billing gates, change broker distribution limits, change owned portal rules, or open internal load-board access.


## v440 Workspace Billing warning copy/status coverage hardening

v440 strengthens the soft warning layer so Workspace Admins see clearer plain-language subscription notices before any billing activation work.

Current behavior:

- Workspace Billing warnings now have a dedicated copy model with status-specific wording.
- Covered warning states include missing subscription, missing plan, provider sync error, canceled subscription, paused subscription, past-due subscription, expired trial, missing trial date, trial ending soon, over-plan usage, active clear state, and fallback billing-review states.
- The Workspace Billing warning API returns a `statusCoverage` object with plain meaning, current impact, workspace next step, Super Admin next step, access statement, Billing Records statement, plan statement, tone, and source signal keys.
- Workspace Admin `/billing` now explains what the notice means, whether work can continue, whether Billing Records is affected, and what the next step is.
- Super Admin `/admin/subscriptions` now reviews warning-copy coverage before hard billing gates are considered.

Important limitation:

- This remains a soft-warning and review-readiness build only. It does not collect payment, create customer portal sessions, mutate subscription status from webhooks, convert trials to paid subscriptions, enforce hard billing gates, change broker distribution limits, change owned portal rules, or open internal load-board access.

## v441 lifecycle audit-note filters and export polish

v441 strengthens the Super Admin review layer around lifecycle audit notes before any billing activation work.

Current behavior:

- The Subscription lifecycle review now classifies each workspace row by audit-note state: needs note, has note, stale note, or no note currently needed.
- Super Admin can review lifecycle audit-note coverage by readiness status and lifecycle status.
- Super Admin can filter lifecycle rows by audit-note state and warning acknowledgement presence.
- Super Admin can search audit state, audit group, latest lifecycle note, and latest warning acknowledgement title from the lifecycle review panel.
- Lifecycle CSV exports now include audit-note state, note count, latest note, note age, warning acknowledgement count, and latest warning acknowledgement title.
- Super Admin can export filtered lifecycle audit-note history and a focused list of rows that still need lifecycle audit notes.
- The lifecycle audit-note API supports read-only query filters for workspace, readiness, lifecycle, search text, and limit.

Important limitation:

- This is review and export hardening only. It does not activate payment collection, customer portal sessions, webhook subscription mutation, trial-to-paid conversion, billing status mutation, hard billing gates, broker distribution limits, owned portal rules, or internal load-board access.


## v442 warning acknowledgement filters and acknowledgement context hardening

v442 strengthens the warning acknowledgement layer that supports soft billing notices before any billing activation work.

Current behavior:

- Workspace Billing warning acknowledgements now include richer context: workspace slug, workspace type, account class, warning status, subscription status, provider sync status, plan name, signal keys, next-step copy, and acknowledgement effect.
- The Workspace Billing warning API can explain whether the current notice is not acknowledged, acknowledged for the current warning, or changed since the last acknowledgement.
- The Subscription lifecycle review now classifies each workspace row by warning acknowledgement state: needs acknowledgement, acknowledged current status, changed since acknowledgement, history only, or no warning needed.
- Super Admin can filter lifecycle rows by acknowledgement state.
- Super Admin can review acknowledgement summaries by state, severity, and warning status.
- Super Admin can export warning acknowledgement context from the Subscription lifecycle panel.
- Workspace Admin Billing can acknowledge a changed current notice again, while an already-current acknowledgement disables the button.

Important limitation:

- This remains a review and soft-warning build only. Acknowledgements do not mute warnings, collect payment, create customer portal sessions, mutate subscription status, convert trials to paid subscriptions, enforce hard billing gates, change broker distribution limits, change owned portal rules, or open internal load-board access.

## v443 lifecycle audit-note stale-review threshold hardening

v443 strengthens Super Admin lifecycle audit-note freshness review before any billing activation work.

Current behavior:

- Lifecycle audit-note stale review now uses risk-based thresholds instead of one fixed 30-day rule.
- Default thresholds are 7 days for blocked-risk rows, 14 days for review-needed rows, 45 days for ready rows, and 60 days for history-only rows.
- Super Admin can see whether each lifecycle row is current, due soon, over threshold, missing a note, missing a note date, or not currently review-needed.
- Each row includes audit cadence, urgency, stale threshold, days until stale, and a refresh reason.
- The Subscription lifecycle panel shows due-status and cadence summaries, plus a due-soon count.
- Lifecycle CSV export includes threshold/cadence context for review evidence.
- New lifecycle audit notes store the reviewed threshold context in audit metadata.

Important limitation:

- This remains a review and soft-warning build only. Thresholds do not collect payment, create customer portal sessions, mutate subscription status, convert trials to paid subscriptions, enforce hard billing gates, change broker distribution limits, change owned portal rules, or open internal load-board access.


## v444 warning acknowledgement current-vs-changed matching hardening

v444 strengthens how Dispatch Spot decides whether a Workspace Billing soft-warning acknowledgement still matches the current notice.

Current behavior:

- New Workspace Billing acknowledgement records store a v444 stable fingerprint version, signal signature, and match basis.
- The match basis compares notice type, warning severity, subscription status, provider sync status, plan name, and normalized signal keys.
- Workspace Admin `/billing` can now show the current signal set, the latest acknowledged signal set, signal signatures, and plain changed reasons when a notice changed after the last acknowledgement.
- Super Admin `/admin/subscriptions` can now review current warning type, current warning severity, current/latest signal signatures, component match state, and changed reasons on lifecycle rows.
- The Warning acknowledgement context summary now includes changed-reason counts so Super Admin can quickly see why acknowledgements are no longer current.
- Lifecycle and acknowledgement CSV exports include current-vs-changed matching fields.

Important limitation:

- This remains a review and soft-warning build only. Acknowledgement matching does not mute warnings, collect payment, create customer portal sessions, mutate subscription status, convert trials to paid subscriptions, enforce hard billing gates, change broker distribution limits, change owned portal rules, or open internal load-board access.


## v445 lifecycle audit-note threshold configuration visibility

- Super Admin `/admin/subscriptions` now exposes the lifecycle audit-note threshold configuration used by the risk-based stale-review system.
- The lifecycle review API now returns each threshold setting with its active value, default value, environment variable name, raw override value, allowed range, source, invalid override flag, clamped override flag, applies-to explanation, review-use explanation, and review-only effect.
- Super Admin can export the threshold configuration as CSV for activation evidence review.
- Threshold settings remain review-only. They only affect stale-note labels, due-soon counts, stale-note counts, and export context.
- Threshold settings do not collect payment, create portal sessions, mutate subscription status, convert trials, enforce hard gates, change broker distribution limits, change owned portal rules, or open internal load-board access.

## v446 final warning/audit evidence closeout bundle

v446 closes the remaining review evidence layer before the customer portal and billing activation test tracks.

Additions:

- The subscription lifecycle review now includes a final evidence closeout summary.
- Evidence closeout covers review-only guardrails, lifecycle audit-note evidence, stale-review threshold configuration evidence, warning acknowledgement evidence, warning match-basis evidence, and export package readiness.
- Each lifecycle workspace row now exposes evidence state, evidence issues, evidence closeout needed, and evidence next step.
- Super Admin can filter lifecycle rows by evidence closeout state.
- Super Admin can export a final evidence closeout CSV containing closeout rows, export manifest rows, and workspace-specific evidence gaps.
- Warning acknowledgement exports now include match-basis, access statement, and Billing Records statement.

Guardrail:

- This evidence layer is review-only. It does not collect payment, create customer portal sessions, return customer portal URLs, mutate subscriptions, convert trials, enforce hard billing gates, or change marketplace/access policy.

## v448 controlled checkout and portal URL return review

v448 moves the Stripe test URL-return track from locked preparation into controlled test-mode review.

Current behavior:

- Super Admin `/admin/subscriptions` now includes a controlled URL-return review panel that combines checkout URL-return readiness and customer portal URL-return readiness.
- The Super Admin review API is `/api/admin/stripe-url-return/controlled-review`.
- Stripe Checkout test-session URL return is allowed only when the guarded checkout test-session flag, checkout URL-return flag, Stripe test mode, approval switches, and billing guardrails are clean.
- Stripe Billing Portal test-session URL return is allowed only when the portal test-session creation flag, portal URL-return flag, Stripe test mode, workspace portal readiness, and billing guardrails are clean.
- Workspace Admin `/billing` can show controlled Stripe test checkout and portal links, but the copy clearly labels them as test-mode review tools only.
- Controlled URL-return events are stored in Super Admin audit evidence and included in checkout readiness, customer portal preparation, billing activation checklist, and lifecycle review evidence.

Important limitation:

- v448 does not activate live payment collection, live customer portal access, webhook subscription mutation, trial-to-paid conversion, billing status mutation, hard billing gates, broker distribution limits, owned portal rules, or internal load-board access.
- The controlled URL-return track is for Stripe test mode only and remains behind explicit environment flags plus Super Admin readiness checks.

## v449 verified webhook subscription-sync test mutation

v449 moves the Stripe webhook/subscription-sync track from review-only logging into controlled provider-sync test mutation. The mutation is deliberately narrow and only updates provider sync fields on matched workspace subscriptions after a signed verified Stripe test webhook is received.

Current behavior:

- The webhook endpoint can apply provider-sync field updates only when webhook intake, subscription sync, and the v449 test mutation flag are enabled.
- Stripe must be in test mode, the webhook signature must verify, the event must be non-live, and the event must match a saved workspace subscription.
- The mutation updates provider sync fields only: billing provider/mode, provider sync status, provider billing status, Stripe IDs when present, current period end, and last provider sync timestamp.
- The same verified Stripe event ID cannot be applied twice.
- Super Admin can review verified test mutation counts, duplicate ignored counts, mutation scope, and audit evidence inside `/admin/subscriptions`.

Guardrail:

- WorkspaceSubscription status remains unchanged. Trial-to-paid conversion remains off. Payment collection, customer portal activation, hard billing gates, broker distribution limits, owned portal rules, and internal load-board access remain unchanged.

## v450 trial-to-paid conversion test checkpoint

v450 adds the first Super Admin trial-to-paid checkpoint layer after verified Stripe provider-sync test mutation.

Current behavior:

- Super Admin `/admin/subscriptions` now includes a **Trial-to-paid conversion test checkpoint** panel.
- New API: `/api/admin/trial-to-paid/test-checkpoint`.
- Trial rows are reviewed for trial end dates, Stripe test IDs, Stripe-ready plan, provider sync status, verified v449 provider-sync evidence, paid-like provider signal, and checkpoint history.
- Ready trial rows can receive a Super Admin checkpoint record only when `DISPATCH_SPOT_STRIPE_TRIAL_TO_PAID_TEST_CHECKPOINT_ENABLED` is enabled.
- Checkpoint recording creates `STRIPE_TRIAL_TO_PAID_TEST_CHECKPOINT_RECORDED` audit evidence only.
- Billing activation master checklist now sees trial-to-paid checkpoint evidence counts.

Important limitation:

- This build does not convert trial workspaces to paid status, collect payment, activate live customer portal behavior, mutate billing status, enforce hard billing gates, change broker distribution limits, change owned portal rules, or open internal load-board access.

## v451 payment collection activation readiness switch

v451 adds the final Super Admin readiness switch layer before any future payment collection activation build.

Current behavior:

- Super Admin `/admin/subscriptions` now includes a **Payment collection activation readiness switch** panel.
- New API: `/api/admin/stripe-payment-collection/activation-readiness`.
- Readiness switches cover master checklist closeout, controlled checkout/customer portal URL-return evidence, verified webhook sync evidence, trial-to-paid checkpoint evidence, activation guardrails, and rollback/support planning.
- Readiness switch records are stored as Super Admin audit events under `STRIPE_PAYMENT_COLLECTION_ACTIVATION_READINESS_SWITCH_UPDATED`.
- Switch recording is locked by default behind `DISPATCH_SPOT_STRIPE_PAYMENT_COLLECTION_ACTIVATION_READINESS_SWITCH_ENABLED="false"`.
- Payment collection activation remains review-only under `DISPATCH_SPOT_STRIPE_PAYMENT_COLLECTION_ACTIVATION_REVIEW_ONLY="true"`.

Important limitation:

- This build does not activate payment collection, live checkout, customer portal activation, webhook subscription mutation, trial-to-paid conversion, hard billing gates, broker distribution limits, owned portal rules, or internal load-board access.
- A later explicit activation build is still required before any customer can be charged.
## v452 soft-to-hard billing gate pilot readiness

v452 adds the review-only pilot allowlist layer that must exist before any future hard billing gate activation build.

Current behavior:

- Super Admin `/admin/subscriptions` now includes a **Soft-to-hard billing gate pilot readiness** panel.
- New API: `/api/admin/hard-billing-gates/pilot-readiness`.
- The pilot review uses hard-gate readiness rows, Workspace Billing warning state, paid workspace classification, subscription status, plan/add-on limit state, and v451 payment collection readiness evidence.
- Super Admin can select or remove low-risk paid workspaces for pilot readiness when `DISPATCH_SPOT_HARD_BILLING_GATE_PILOT_READINESS_ENABLED` is enabled.
- Pilot selections are stored as Super Admin audit events under `HARD_BILLING_GATE_PILOT_READINESS_UPDATED`.
- The billing activation master checklist now sees pilot selection evidence counts.
- Added `.env.example` flags:
  - `DISPATCH_SPOT_HARD_BILLING_GATE_PILOT_READINESS_ENABLED="false"`
  - `DISPATCH_SPOT_HARD_BILLING_GATE_PILOT_REVIEW_ONLY="true"`
  - `DISPATCH_SPOT_HARD_BILLING_GATE_PILOT_WORKSPACE_SLUGS=""`

Important limitation:

- This build does not activate hard billing gates, pilot enforcement, payment collection, billing status mutation, broker distribution limits, owned portal rules, or internal load-board access.
- Pilot readiness records evidence only. A later explicit activation build is still required before any workspace access can be affected.

v453 — Hard Billing Gate Controlled Activation

Added pilot-only hard billing gate controlled activation review in Super Admin, runtime pilot policy support by workspace identifier, controlled activation impact rows, review history, and CSV exports. Payment collection, billing status mutation, broker distribution limits, owned portal rules, and internal load-board access remain unchanged. Prisma schema changed: No.